package com.hksj.Intelligentmanagement.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hksj.Intelligentmanagement.common.Rest;
import com.hksj.Intelligentmanagement.dto.CallDeviceScreenWithTaskOrderDTO;
import com.hksj.Intelligentmanagement.dto.CallTaskOrderDTO;
import com.hksj.Intelligentmanagement.dto.CallUserWithTaskOrderDTO;
import com.hksj.Intelligentmanagement.dto.DateQueryDTO;
import com.hksj.Intelligentmanagement.service.CallTaskOrderService;
import com.hksj.Intelligentmanagement.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "呼叫任务单管理")
@RestController
@RequestMapping("/api/task/order")
public class CallTaskOrderController {
    @Autowired
    private CallTaskOrderService taskOrderService;

    @ApiOperation("分页查询所有任务单")
    @PostMapping("/pageTaskOrder")
    public Rest<IPage<CallTaskOrderVo>> pageTaskOrder(@RequestBody CallTaskOrderDTO dto){
        return Rest.ok(taskOrderService.pageTaskOrder(dto));
    }

    @ApiOperation("分页查询用户及用户接单数据")
    @PostMapping("/pageUserTaskOrder")
    public Rest<IPage<CallUserTaskOrderVo>> pageUserTaskOrder(@RequestBody CallUserWithTaskOrderDTO dto){
        return Rest.ok(taskOrderService.pageUserTaskOrder(dto));
    }

    @ApiOperation("分页查询手术室及手术室派单数据")
    @PostMapping("/pageScreenTaskOrder")
    public Rest<IPage<CallDeviceScreenOrderVo>> pageScreenTaskOrder(@RequestBody CallDeviceScreenWithTaskOrderDTO dto){
        return Rest.ok(taskOrderService.pageScreenTaskOrder(dto));
    }

    @ApiOperation("呼叫台呼叫量统计")
    @PostMapping("/listDispatchOrderNum")
    public Rest<List<StatisticsDispatchOrderNumVo>> listDispatchOrderNum(@RequestBody DateQueryDTO dto){
        return Rest.ok(taskOrderService.listDispatchOrderNum(dto));
    }

    @ApiOperation("接单量排名")
    @PostMapping("/listObtainOrderNumRanking")
    public Rest<List<StatisticsObtainOrderNumVo>> listObtainOrderNumRanking(@RequestBody DateQueryDTO dto){
        return Rest.ok(taskOrderService.listObtainOrderNum(dto));
    }

    @ApiOperation("完单数趋势")
    @PostMapping("/listDayCompleteOrderNum")
    public Rest<List<CompleteOrderNumResultVo>> listDayCompleteOrderNum(@RequestBody DateQueryDTO dto){
        return Rest.ok(taskOrderService.listDayCompleteOrderNum(dto));
    }

    @ApiOperation("完单数统计")
    @PostMapping("/getCompleteOrderNum")
    public Rest<List<CompleteOrderNumSimpleResultVo>> getCompleteOrderNum(@RequestBody DateQueryDTO dto){
        return Rest.ok(taskOrderService.getCompleteOrderNum(dto));
    }

    @ApiOperation("呼叫响应均次时长")
    @PostMapping("/listDayObtainDuration")
    public Rest<List<ObtainDurationResultVo>> listDayObtainDuration(@RequestBody DateQueryDTO dto){
        return Rest.ok(taskOrderService.listDayObtainDuration(dto));
    }

    @ApiOperation("完成任务单均次时长")
    @PostMapping("/listDayCompleteDuration")
    public Rest<List<CompleteDurationResultVo>> listDayCompleteDuration(@RequestBody DateQueryDTO dto){
        return Rest.ok(taskOrderService.listDayCompleteDuration(dto));
    }

    @ApiOperation("获取大屏头部统计数据")
    @GetMapping("/getStatisticsInfo")
    public Rest<StatisticsInfoVo> getStatisticsInfo(){
        return Rest.ok(taskOrderService.getStatisticsInfo());
    }
}
